700
|
How can I filter the check-boxes (method 1)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oColumn := oGrid:Columns():Add("Check")
oEditor := oColumn:Editor()
oEditor:EditType := 19/*CheckValueType*/
oEditor:SetProperty("Option",17/*exCheckValue2*/,1)
oColumn:DisplayFilterButton := .T.
oColumn:DisplayFilterPattern := .F.
oColumn:FilterType := 6/*exCheck*/
oItems := oGrid:Items()
oItems:AddItem(.T.)
oItems:AddItem(.T.)
oItems:AddItem(.F.)
oItems:AddItem(.T.)
oItems:AddItem(.F.)
oItems:AddItem(.T.)
oItems:AddItem(.F.)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
699
|
How can add a button to control

PROCEDURE OnButtonClick(oGrid,Item,ColIndex,Key)
DevOut( "ButtonClick" )
DevOut( oGrid:Items:CellCaption(Item,ColIndex) )
DevOut( Transform(Key,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oEditor,oEditor1
LOCAL oItems
LOCAL h,s
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ButtonClick := {|Item,ColIndex,Key| OnButtonClick(oGrid,Item,ColIndex,Key)} /*Occurs when user clicks on the cell's button.*/
oGrid:BeginUpdate()
oGrid:DefaultItemHeight := 22
oGrid:HeaderHeight := 22
oGrid:Appearance := 0/*None2*/
oGrid:DrawGridLines := -2/*exRowLines*/
oGrid:ScrollBySingleLine := .F.
oGrid:Images("gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yNAOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=")
oGrid:SetProperty("HTMLPicture","pic1","c:\exontrol\images\auction.gif")
oColumns := oGrid:Columns()
oColumn := oColumns:Add("Type")
oColumn:Width := 48
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1 := oColumns:Add("Appearance")
oColumn1:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn1:Alignment := 1/*CenterAlignment*/
oColumn1:HeaderAlignment := 1/*CenterAlignment*/
oItems := oGrid:Items()
h := oItems:AddItem("Items.<b>CellHasButton</b> property")
oItems:SetProperty("CellValue",h,1,"Button <b>1</b>")
oItems:SetProperty("CellHasButton",h,1,.T.)
h := oItems:AddItem("Items.<b>CellButtonAutoWidth</b> property")
oItems:SetProperty("CellValue",h,1," Button <b>2</b> ")
oItems:SetProperty("CellHasButton",h,1,.T.)
oItems:SetProperty("CellButtonAutoWidth",h,1,.T.)
h := oItems:AddItem("Items.<b>CellHasButton</b> property")
oItems:SetProperty("CellValue",h,1," <img>2</img>Button <b>3</b> ")
oItems:SetProperty("CellHasButton",h,1,.T.)
oItems:SetProperty("CellButtonAutoWidth",h,1,.T.)
h := oItems:AddItem("Items.<b>CellHasButton</b> property")
oItems:SetProperty("ItemHeight",h,32)
oItems:SetProperty("CellValue",h,1," <img>2</img>Button <b>4</b> <img>pic1</img> ")
oItems:SetProperty("CellHasButton",h,1,.T.)
oItems:SetProperty("CellButtonAutoWidth",h,1,.T.)
h := oItems:AddItem("Items.<b>CellHasButton</b> in splitted cells")
oItems:SetProperty("CellValue",h,1," Button <b>5.1</b> ")
oItems:SetProperty("CellHasButton",h,1,.T.)
oItems:SetProperty("CellButtonAutoWidth",h,1,.T.)
s := oItems:SplitCell(h,1)
oItems:SetProperty("CellValue",0,s," Button <b>5.2</b> ")
oItems:SetProperty("CellHasButton",0,s,.T.)
oItems:SetProperty("CellButtonAutoWidth",0,s,.T.)
h := oItems:AddItem("Column.<b>Editor</b>, Items.<b>CellEditor</b>")
oItems:SetProperty("CellValue",h,1,"Visible when clicking the cell")
oEditor := oItems:CellEditor(h,1)
oEditor:EditType := 1/*EditType*/
oEditor:AddButton("B1",1,0,"This is a bit of text that's shown when the cursor hovers the button B1")
oEditor:AddButton("B3",2,1,"This is a bit of text that's shown when the cursor hovers the button B3")
oEditor:AddButton("B4",1,1,"This is a bit of text that's shown when the cursor hovers the button B4")
oEditor:ButtonWidth := 24
h := oItems:AddItem("Column.<b>Editor</b>, Items.<b>CellEditor</b>")
oItems:SetProperty("CellValue",h,1,3)
oEditor1 := oItems:CellEditor(h,1)
oEditor1:EditType := 6/*CheckListType*/
oEditor1:AddItem(1,"Flag 1")
oEditor1:AddItem(2,"Flag 2")
oEditor1:AddItem(4,"Flag 4")
oEditor1:AddItem(8,"Flag 8")
oEditor1:AddButton("C1",1,0,"This is a bit of text that's shown when the cursor hovers the button C1")
oEditor1:AddButton("C3",2,0,"This is a bit of text that's shown when the cursor hovers the button C2")
oEditor1:AddButton("C4",1,0,"This is a bit of text that's shown when the cursor hovers the button C3")
oEditor1:ButtonWidth := 24
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
698
|
The item is not getting selected when clicking the cell's checkbox. What should I do

PROCEDURE OnCellStateChanged(oGrid,Item,ColIndex)
oGrid:Items():SetProperty("SelectItem",Item,.T.)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:CellStateChanged := {|Item,ColIndex| OnCellStateChanged(oGrid,Item,ColIndex)} /*Fired after cell's state has been changed.*/
oGrid:Columns():Add("Check"):SetProperty("Def",0/*exCellHasCheckBox*/,.T.)
oItems := oGrid:Items()
oItems:AddItem(0)
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
697
|
Is it possible to limit the height of the item while resizing

PROCEDURE OnAddItem(oGrid,Item)
oGrid:Items():SetProperty("ItemMinHeight",Item,18)
oGrid:Items():SetProperty("ItemMaxHeight",Item,72)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AddItem := {|Item| OnAddItem(oGrid,Item)} /*Occurs after a new Item has been inserted to Items collection.*/
oGrid:BeginUpdate()
oGrid:ItemsAllowSizing := -1/*exResizeItem*/
oGrid:ScrollBySingleLine := .F.
oGrid:SetProperty("BackColorAlternate",AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oGrid:Columns():Add("Names")
oItems := oGrid:Items()
oItems:AddItem("Mantel")
oItems:AddItem("Mechanik")
oItems:AddItem("Motor")
oItems:AddItem("Murks")
oItems:AddItem("Märchen")
oItems:AddItem("Möhren")
oItems:AddItem("Mühle")
oGrid:Columns:Item(0):SortOrder := 1/*SortAscending*/
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
696
|
Is it possible to copy the hierarchy of the control using the GetItems method

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Def")
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oGrid:PutItems(oGrid:GetItems(-1))
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
695
|
Is it possible to auto-numbering the children items but still keeps the position after filtering

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3,oColumn4,oColumn5,oColumn6
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oColumn := oGrid:Columns():Add("Items")
oColumn:DisplayFilterButton := .T.
oColumn:FilterType := 240/*exFilter*/
oColumn:Filter := "Child 2"
oColumn1 := oGrid:Columns():Add("Pos.1")
oColumn1:FormatColumn := "1 ropos ''"
oColumn1:Position := 0
oColumn1:Width := 32
oColumn1:AllowSizing := .F.
oColumn2 := oGrid:Columns():Add("Pos.2")
oColumn2:FormatColumn := "1 ropos ':'"
oColumn2:Position := 1
oColumn2:Width := 32
oColumn2:AllowSizing := .F.
oColumn3 := oGrid:Columns():Add("Pos.3")
oColumn3:FormatColumn := "1 ropos ':|A-Z'"
oColumn3:Position := 2
oColumn3:Width := 32
oColumn3:AllowSizing := .F.
oColumn4 := oGrid:Columns():Add("Pos.4")
oColumn4:FormatColumn := "1 ropos '|A-Z|'"
oColumn4:Position := 3
oColumn4:Width := 32
oColumn4:AllowSizing := .F.
oColumn5 := oGrid:Columns():Add("Pos.5")
oColumn5:FormatColumn := "'<font Tahoma;7>' + 1 ropos '-<b>||A-Z'"
oColumn5:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn5:Position := 4
oColumn5:Width := 32
oColumn5:AllowSizing := .F.
oColumn6 := oGrid:Columns():Add("Pos.6")
oColumn6:FormatColumn := "'<b>'+ 1 ropos '</b>:<fgcolor=FF0000>|A-Z|'"
oColumn6:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn6:Position := 5
oColumn6:Width := 48
oColumn6:AllowSizing := .F.
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oGrid:ApplyFilter()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
694
|
Is it possible to auto-numbering the children items too

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3,oColumn4,oColumn5
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oColumn := oGrid:Columns():Add("Pos.1")
oColumn:FormatColumn := "1 rpos ''"
oColumn:Position := 0
oColumn:Width := 32
oColumn:AllowSizing := .F.
oColumn1 := oGrid:Columns():Add("Pos.2")
oColumn1:FormatColumn := "1 rpos ':'"
oColumn1:Position := 1
oColumn1:Width := 32
oColumn1:AllowSizing := .F.
oColumn2 := oGrid:Columns():Add("Pos.3")
oColumn2:FormatColumn := "1 rpos ':|A-Z'"
oColumn2:Position := 2
oColumn2:Width := 32
oColumn2:AllowSizing := .F.
oColumn3 := oGrid:Columns():Add("Pos.4")
oColumn3:FormatColumn := "1 rpos '|A-Z|'"
oColumn3:Position := 3
oColumn3:Width := 32
oColumn3:AllowSizing := .F.
oColumn4 := oGrid:Columns():Add("Pos.5")
oColumn4:FormatColumn := "'<font Tahoma;7>' + 1 rpos '-<b>||A-Z'"
oColumn4:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn4:Position := 4
oColumn4:Width := 32
oColumn4:AllowSizing := .F.
oColumn5 := oGrid:Columns():Add("Pos.6")
oColumn5:FormatColumn := "'<b>'+ 1 rpos '</b>:<fgcolor=FF0000>|A-Z|'"
oColumn5:SetProperty("Def",17/*exCellValueFormat*/,1)
oColumn5:Position := 5
oColumn5:Width := 48
oColumn5:AllowSizing := .F.
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
693
|
Is it possible to cancel or discard the values during validation

PROCEDURE OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)
DevOut( "ValidateValue" )
DevOut( Transform(NewValue,"") )
DevOut( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value. " )
DevOut( "The DiscardValidateValue restores back the previously values." )
oGrid:DiscardValidateValue()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ValidateValue := {|Item,ColIndex,NewValue,Cancel| OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)} /*Occurs before user changes the cell's value.*/
oGrid:BeginUpdate()
oGrid:CauseValidateValue := -1/*exValidateCell*/
oGrid:Columns():Add("Date"):Editor():EditType := 7/*DateType*/
oGrid:Columns():Add("Text"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
692
|
Is it possible to validate the values of the cells only when user leaves the focused item
PROCEDURE OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)
DevOut( "ValidateValue" )
DevOut( Transform(NewValue,"") )
DevOut( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value. " )
Cancel := .T.
DevOut( "You can not leave the item/record until the Cancel is False." )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ValidateValue := {|Item,ColIndex,NewValue,Cancel| OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)} /*Occurs before user changes the cell's value.*/
oGrid:BeginUpdate()
oGrid:CauseValidateValue := 1/*exValidateItem*/
oGrid:Columns():Add("Date"):Editor():EditType := 7/*DateType*/
oGrid:Columns():Add("Text"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
691
|
We would like to validate the values of the cells. Is it possible

PROCEDURE OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)
DevOut( "ValidateValue" )
DevOut( Transform(NewValue,"") )
DevOut( "Change the Cancel parameter for ValidateValue event to accept/decline the newly value." )
Cancel := .T.
DevOut( "You can not leave the cell until the Cancel is False." )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ValidateValue := {|Item,ColIndex,NewValue,Cancel| OnValidateValue(oGrid,Item,ColIndex,NewValue,Cancel)} /*Occurs before user changes the cell's value.*/
oGrid:BeginUpdate()
oGrid:CauseValidateValue := -1/*exValidateCell*/
oGrid:Columns():Add("Date"):Editor():EditType := 7/*DateType*/
oGrid:Columns():Add("Text"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oItems:SetProperty("CellValue",oItems:AddItem("01/01/2001"),1,"text")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
690
|
Is there any way to add auto-numbering

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oColumns := oGrid:Columns()
oColumns:Add("Items")
oColumn := oColumns:Add("Pos")
oColumn:FormatColumn := "1 pos ''"
oColumn:Position := 0
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
689
|
Does your control supports multiple lines tooltip

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:SetProperty("HTMLPicture","pic1","c:\exontrol\images\zipdisk.gif")
oGrid:ToolTipDelay := 1
oGrid:Columns():Add("tootip"):ToolTip := "<br><font Tahoma;10>This</font> is a <b>multi-lines</b> tooltip assigned to a column. The tooltip supports built-in HTML tags, icons and pictures.<br><br><br><img>pic1</img> picture ... <br><br>"
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
688
|
How can I prevent highlighting the column from the cursor - point

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:VisualAppearance():Add(1,"gBFLBCJwBAEHhEJAEGg4BI0IQAAYAQGKIYBkAKBQAGaAoDDUOQzQwAAxDKKUEwsACEIrjKCYVgOHYYRrIMYgBCMJhLEoaZLhEZRQiqDYtRDFQBSDDcPw/EaRZohGaYJgEgI=")
oGrid:SetProperty("Background",32/*exCursorHoverColumn*/,0x1000000)
oGrid:Columns():Add("S"):Width := 32
oGrid:Columns():Add("Level 1"):LevelKey := 1
oGrid:Columns():Add("Level 2"):LevelKey := 1
oGrid:Columns():Add("Level 3"):LevelKey := 1
oGrid:Columns():Add("E1"):Width := 32
oGrid:Columns():Add("E2"):Width := 32
oGrid:Columns():Add("E3"):Width := 32
oGrid:Columns():Add("E4"):Width := 32
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
687
|
Is it possible display numbers in the same format no matter of regional settings in the control panel

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default positive)'")
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '2|.|3|,|1|1')")
h := oItems:AddItem(-100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default negative)'")
h := oItems:AddItem(-100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '2|.|3|,|1|1')")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
686
|
Is it possible to add a 0 for numbers less than 1 instead .7 to show 0.8

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(0.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(0.27)
oItems:SetProperty("FormatCell",h,0,"(value format '|||||0') + ' <fgcolor=808080>(Display no leading zeros)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
685
|
How can I specify the format for negative numbers

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(-100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(-100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '||||1') + ' <fgcolor=808080>(Negative sign, number; for example, -1.1)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
684
|
Is it possible to change the grouping character when display numbers

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '|||-') + ' <fgcolor=808080>(grouping character is -)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
683
|
How can I display numbers with 2 digits in each group

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(100000.27)
oItems:SetProperty("FormatCell",h,0,"(value format '||2') + ' <fgcolor=808080>(grouping by 2 digits)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
682
|
How can I display my numbers using a different decimal separator

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format '|;') + ' <fgcolor=808080>(decimal separator is <b>;</b>)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
681
|
Is it possible to display the numbers using 3 (three) digits

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Def"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format '') + ' <fgcolor=808080>(default)'")
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format '3') + ' <fgcolor=808080>(3 digits)'")
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format 2) + ' <fgcolor=808080>(2 digits)'")
h := oItems:AddItem(100.27)
oItems:SetProperty("FormatCell",h,0,"(value format 1) + ' <fgcolor=808080>(1 digit)'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
680
|
Is there any option to show the tooltip programmatically

PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
oGrid:ShowToolTip(Transform(oGrid:ItemFromPoint(-1,-1,c,hit),""),"","8","8")
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:Columns():Add("Def")
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
679
|
How can I specify the column's width to be the same for all columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oColumns := oGrid:Columns()
oColumns:Add("A")
oColumns:Add("B")
oColumns:Add("C")
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:ColumnAutoResize := .T.
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
678
|
How can I set the column's width to my desired width

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ColumnAutoResize := .F.
oColumns := oGrid:Columns()
oColumns:Add("A"):Width := 128
oColumns:Add("B"):Width := 128
oGrid:DrawGridLines := -1/*exAllLines*/
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
677
|
Is it possible to format numbers

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3
LOCAL oColumns
LOCAL oItems
LOCAL h,h1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("A")
oColumn:SortType := 1/*SortNumeric*/
oColumn:AllowSizing := .F.
oColumn:Width := 36
oColumn:FormatColumn := "len(value) ? value + ' +'"
oColumn:Editor():EditType := 4/*SpinType*/
oColumn1 := oColumns:Add("B")
oColumn1:SortType := 1/*SortNumeric*/
oColumn1:AllowSizing := .F.
oColumn1:Width := 36
oColumn1:FormatColumn := "len(value) ? value + ' +'"
oColumn1:Editor():EditType := 4/*SpinType*/
oColumn2 := oColumns:Add("C")
oColumn2:SortType := 1/*SortNumeric*/
oColumn2:AllowSizing := .F.
oColumn2:Width := 36
oColumn2:FormatColumn := "len(value) ? value + ' ='"
oColumn2:Editor():EditType := 4/*SpinType*/
oColumn3 := oColumns:Add("A+B+C")
oColumn3:SortType := 1/*SortNumeric*/
oColumn3:Width := 64
oColumn3:ComputedField := "dbl(%1)+dbl(%2)+dbl(%3)"
oColumn3:FormatColumn := "type(value) in (0,1) ? 'null' : ( dbl(value)<0 ? '<fgcolor=FF0000>'+ (value format '2|.|3|,|1' ) : (dbl(value)>0 ? '<fgcolor=0000FF>+'+(value format '2|.|3|,' ): '0.00') )"
oColumn3:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("CellValueFormat",h,4,2/*exComputedField*/)
h1 := oItems:InsertItem(h,,"Child 1")
oItems:SetProperty("CellValue",h1,1,7)
oItems:SetProperty("CellValue",h1,2,3)
oItems:SetProperty("CellValue",h1,3,1)
h1 := oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("CellValue",h1,1,-2)
oItems:SetProperty("CellValue",h1,2,-2)
oItems:SetProperty("CellValue",h1,3,-4)
h1 := oItems:InsertItem(h,,"Child 3")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,2)
oItems:SetProperty("CellValue",h1,3,-4)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
676
|
How can I collapse all items

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",0,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
675
|
How can I expand all items

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",0,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
674
|
Can I display a total field without having to add a child item

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Numbers")
oColumn:SortType := 1/*SortNumeric*/
oEditor := oColumn:Editor()
oEditor:EditType := 4/*SpinType*/
oEditor:Numeric := 1/*exFloat*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
oItems:SetProperty("LockedItemCount",2/*exBottom*/,1)
h := oItems:LockedItem(2/*exBottom*/,0)
oItems:SetProperty("CellValue",h,0,"sum(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'SUM: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
673
|
Can I display the number of child items

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h,hx
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := 1/*exGroupLinesAtRoot*/
oGrid:Columns():Add("")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
hx := oItems:SplitCell(h,0)
oItems:SetProperty("CellValue",0,hx,"count(current,dir,1)")
oItems:SetProperty("CellValueFormat",0,hx,4/*exTotalField*/)
oItems:SetProperty("FormatCell",0,hx,"'Childs: ' + value")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
hx := oItems:SplitCell(h,0)
oItems:SetProperty("CellValue",0,hx,"count(current,dir,1)")
oItems:SetProperty("CellValueFormat",0,hx,4/*exTotalField*/)
oItems:SetProperty("FormatCell",0,hx,"'Childs: ' + value")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:InsertItem(h,,"Child 3")
oItems:InsertItem(h,,"Child 4")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
672
|
My field does not display the correctly computed value if I enter data using the control's editors ( concatenation of strings ). What am I doing wrong

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor,oEditor1
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("T")
oEditor := oGrid:Columns():Add("A"):Editor()
oEditor:Numeric := -1/*exInteger*/
oEditor:EditType := 4/*SpinType*/
oEditor1 := oGrid:Columns():Add("B"):Editor()
oEditor1:Numeric := -1/*exInteger*/
oEditor1:EditType := 4/*SpinType*/
oGrid:Columns():Add("A+B")
oItems := oGrid:Items()
h := oItems:AddItem("Incorrect")
oItems:SetProperty("CellToolTip",h,0,"Just type a number in the column A or B. The result will be concaternated")
oItems:SetProperty("CellValue",h,1,"10")
oItems:SetProperty("CellValue",h,2,"20")
oItems:SetProperty("CellValue",h,3,"currency(%1+%2)")
oItems:SetProperty("CellValueFormat",h,3,2/*exComputedField*/)
h := oItems:AddItem("Correct")
oItems:SetProperty("CellValue",h,1,10)
oItems:SetProperty("CellValue",h,2,20)
oItems:SetProperty("CellValue",h,3,"currency(dbl(%1)+dbl(%2))")
oItems:SetProperty("CellValueFormat",h,3,2/*exComputedField*/)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
671
|
The CellValue/CellCaption property gets the result of a computed/total field with text formatting. Is it possible to get that value without text formatting

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("A"):Editor():EditType := 4/*SpinType*/
oGrid:Columns():Add("B"):Editor():EditType := 4/*SpinType*/
oGrid:Columns():Add("A+B")
oItems := oGrid:Items()
h := oItems:AddItem(10)
oItems:SetProperty("CellValue",h,1,20)
oItems:SetProperty("CellValueFormat",h,2,2/*exComputedField*/)
oItems:SetProperty("CellValue",h,2,"currency(dbl(%0)+dbl(%1))")
DevOut( "CellCaption returns " )
DevOut( oItems:CellCaption(h,2) )
DevOut( "CellValue returns " )
DevOut( Transform(oItems:CellValue(h,2),"") )
DevOut( "ComputeValue returns " )
DevOut( Transform(oItems:ComputeValue("dbl(%0)+dbl(%1)",h,0,oItems:CellValueFormat(h,2)),"") )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
670
|
Can I get the result of a specified formula as your control does using the ComputedField property
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("A")
oGrid:Columns():Add("B")
oItems := oGrid:Items()
h := oItems:AddItem(10)
oItems:SetProperty("CellValue",h,1,20)
DevOut( "A+B is " )
DevOut( Transform(oItems:ComputeValue("dbl(%0)+dbl(%1)",h,0,2),"") )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
669
|
Is it possible to get the text without HTML formatting

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("")
oItems := oGrid:Items()
h := oItems:AddItem("<b>bold</b>")
DevOut( Transform(oItems:ComputeValue(oItems:CellValue(h,0),h,0,1),"") )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
668
|
Can I specify an item to be a separator

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:SortOnClick := 0/*exNoSort*/
oGrid:Columns():Add("Numbers")
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
h := oItems:AddItem("separator")
oItems:SetProperty("SelectableItem",h,.F.)
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemDividerLineAlignment",h,1/*DividerCenter*/)
oItems:SetProperty("ItemDividerLine",h,5/*ThinLine*/)
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:AddItem(3)
oItems:AddItem(4)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
667
|
How can I count only non-zero values

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(0)
oItems:AddItem(0)
oItems:AddItem(0)
oItems:AddItem(0)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("sum(all,dir,dbl(%0)?1:0)")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'COUNT non-zero: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
666
|
How can I add a AVG ( average ) field

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("avg(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'AVG: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
665
|
How can I add a COUNT field

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("count(all,dir,0)")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'COUNT: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
664
|
How can I add a MAX field

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("max(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'MAX: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
663
|
How can I add a MIN or MAX field (for numbers)

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(11)
oItems:AddItem(21)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("min(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'MIN: '+value")
h := oItems:AddItem("max(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'MAX: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
662
|
How can I add a SUM field

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("sum(all,dir,dbl(%0))")
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'SUM: '+value")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
661
|
How can I add total and subtotals fields

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := 1/*exGroupLinesAtRoot*/
oGrid:Columns():Add("Members")
oColumn := oGrid:Columns():Add("Values")
oColumn:FormatColumn := "currency(value)"
oEditor := oColumn:Editor()
oEditor:EditType := 4/*SpinType*/
oEditor:Numeric := -1/*exInteger*/
oItems := oGrid:Items()
h := oItems:AddItem("Group 1")
oItems:SetProperty("ItemBold",h,.T.)
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("CellValue",h,1,"sum(current,dir,dbl(%1))")
oItems:SetProperty("CellValueFormat",h,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("CellHAlignment",h,1,2/*RightAlignment*/)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,10)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,20)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,30)
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Group 2")
oItems:SetProperty("ItemBold",h,.T.)
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("CellValue",h,1,"sum(current,dir,dbl(%1))")
oItems:SetProperty("CellValueFormat",h,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("CellHAlignment",h,1,2/*RightAlignment*/)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,5)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,15)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,35)
h := oItems:AddItem("total")
oItems:SetProperty("CellValue",h,1,"sum(all,rec,dbl(%1))")
oItems:SetProperty("CellValueFormat",h,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("FormatCell",h,1,"'Total: <b>' + currency(value)")
oItems:SetProperty("CellHAlignment",h,1,2/*RightAlignment*/)
oItems:SetProperty("ItemDivider",h,1)
oItems:SetProperty("ItemDividerLineAlignment",h,1/*DividerCenter*/)
oItems:SetProperty("ItemDividerLine",h,2/*DoubleLine*/)
oItems:SetProperty("SortableItem",h,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
660
|
Is is possible to have subtotal items, and a grand total item

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems
LOCAL h,hT
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oGrid:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,255,255 } ) , .F. ))
oGrid:LinesAtRoot := 1/*exGroupLinesAtRoot*/
oGrid:ShowFocusRect := .F.
oGrid:Columns():Add("Members")
oColumn := oGrid:Columns():Add("Values")
oColumn:FormatColumn := "currency(value)"
oEditor := oColumn:Editor()
oEditor:EditType := 4/*SpinType*/
oEditor:Numeric := -1/*exInteger*/
oItems := oGrid:Items()
h := oItems:AddItem("Group 1")
oItems:SetProperty("ItemBold",h,.T.)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("FormatCell",h,1," ")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,10)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,20)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,30)
hT := oItems:InsertItem(h,,"subtotal")
oItems:SetProperty("CellHAlignment",hT,1,2/*RightAlignment*/)
oItems:SetProperty("CellEditorVisible",hT,1,0/*exEditorHidden*/)
oItems:SetProperty("CellValue",hT,1,"sum(parent,dir,dbl(%1))")
oItems:SetProperty("CellValueFormat",hT,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("FormatCell",hT,1,"'subtotal: <b>' + currency(value)")
oItems:SetProperty("ItemDivider",hT,1)
oItems:SetProperty("ItemDividerLineAlignment",hT,1/*DividerCenter*/)
oItems:SetProperty("SortableItem",hT,.F.)
oItems:SetProperty("SelectableItem",hT,.F.)
oItems:SetProperty("ItemDividerLine",hT,3/*DotLine*/)
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Group 2")
oItems:SetProperty("ItemBold",h,.T.)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("FormatCell",h,1," ")
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,15)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,25)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,18)
hT := oItems:InsertItem(h,,"subtotal")
oItems:SetProperty("CellHAlignment",hT,1,2/*RightAlignment*/)
oItems:SetProperty("CellEditorVisible",hT,1,0/*exEditorHidden*/)
oItems:SetProperty("CellValue",hT,1,"sum(parent,dir,dbl(%1))")
oItems:SetProperty("CellValueFormat",hT,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("FormatCell",hT,1,"'subtotal: <b>' + currency(value)")
oItems:SetProperty("ItemDivider",hT,1)
oItems:SetProperty("ItemDividerLineAlignment",hT,1/*DividerCenter*/)
oItems:SetProperty("ItemDividerLine",hT,3/*DotLine*/)
oItems:SetProperty("SortableItem",hT,.F.)
oItems:SetProperty("SelectableItem",hT,.F.)
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("total")
oItems:SetProperty("CellValue",h,1,"sum(all,rec,dbl(%1))")
oItems:SetProperty("CellValueFormat",h,1,5/*exTotalField+exHTML*/)
oItems:SetProperty("CellEditorVisible",h,1,0/*exEditorHidden*/)
oItems:SetProperty("FormatCell",h,1,"'Total: <b><font ;11>' + currency(value)")
oItems:SetProperty("CellHAlignment",h,1,1/*CenterAlignment*/)
oItems:SetProperty("ItemDivider",h,1)
oItems:SetProperty("ItemDividerLineAlignment",h,1/*DividerCenter*/)
oItems:SetProperty("ItemDividerLine",h,2/*DoubleLine*/)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SetProperty("SelectableItem",h,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
659
|
Is it possible to have a total field for each column

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oEditor,oEditor1
LOCAL oItems,oItems1
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("C1")
oEditor := oColumn:Editor()
oEditor:Numeric := -1/*exInteger*/
oEditor:EditType := 4/*SpinType*/
oColumn:SortType := 1/*SortNumeric*/
oColumn1 := oGrid:Columns():Add("C2")
oEditor1 := oColumn1:Editor()
oEditor1:Numeric := -1/*exInteger*/
oEditor1:EditType := 4/*SpinType*/
oColumn1:SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:SetProperty("LockedItemCount",2/*exBottom*/,1)
h := oItems:LockedItem(2/*exBottom*/,0)
oItems:SetProperty("ItemBackColor",h,AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oItems:SetProperty("ItemBold",h,.T.)
oItems:SetProperty("CellValue",h,0,"sum(all,dir,dbl(%0))")
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellValue",h,1,"sum(all,dir,dbl(%1))")
oItems:SetProperty("CellValueFormat",h,1,4/*exTotalField*/)
oItems1 := oGrid:Items()
oItems1:SetProperty("CellValue",oItems1:AddItem(10),1,12)
oItems1:SetProperty("CellValue",oItems1:AddItem(25),1,5)
oItems1:SetProperty("CellValue",oItems1:AddItem(31),1,17)
oItems1:SetProperty("CellValue",oItems1:AddItem(48),1,22)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
658
|
How can I add a total field for a DataSource being used

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
LOCAL rs
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:ColumnAutoResize := .F.
oGrid:ContinueColumnScroll := .F.
rs := CreateObject("ADOR.Recordset")
rs:Open("Orders","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb",3/*adOpenStatic*/,3/*adLockOptimistic*/)
oGrid:DataSource := rs
oItems := oGrid:Items()
oItems:SetProperty("LockedItemCount",0/*exTop*/,1)
h := oItems:LockedItem(0/*exTop*/,0)
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("CellValueFormat",h,0,5/*exTotalField+exHTML*/)
oItems:SetProperty("CellValue",h,0,"sum(all,dir,%1)")
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
657
|
How can I add a total field

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oEditor
LOCAL oItems,oItems1
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oColumn := oGrid:Columns():Add("Numbers")
oEditor := oColumn:Editor()
oEditor:Numeric := -1/*exInteger*/
oEditor:EditType := 4/*SpinType*/
oColumn:SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:SetProperty("LockedItemCount",0/*exTop*/,1)
h := oItems:LockedItem(0/*exTop*/,0)
oItems:SetProperty("ItemBackColor",h,AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oItems:SetProperty("CellValue",h,0,"sum(all,dir,dbl(%0))")
oItems:SetProperty("CellValueFormat",h,0,4/*exTotalField*/)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("FormatCell",h,0,"'Total: '+value")
oItems1 := oGrid:Items()
oItems1:AddItem(10)
oItems1:AddItem(25)
oItems1:AddItem(31)
oItems1:AddItem(48)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
656
|
How can I add a total field

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
oGrid:Refresh()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
LOCAL h,hT
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oEditor := oGrid:Columns():Add("Items"):Editor()
oEditor:EditType := 4/*SpinType*/
oEditor:Numeric := -1/*exInteger*/
oItems := oGrid:Items()
h := oItems:AddItem("Group 1")
oItems:SetProperty("CellEditorVisible",h,0,0/*exEditorHidden*/)
oItems:InsertItem(h,,10)
oItems:InsertItem(h,,20)
oItems:InsertItem(h,,30)
hT := oItems:InsertItem(h,,"sum(parent,dir,dbl(%0))")
oItems:SetProperty("CellEditorVisible",hT,0,0/*exEditorHidden*/)
oItems:SetProperty("CellValueFormat",hT,0,5/*exTotalField+exHTML*/)
oItems:SetProperty("ItemDivider",hT,0)
oItems:SetProperty("ItemDividerLineAlignment",hT,2/*DividerTop*/)
oItems:SetProperty("SelectableItem",hT,.F.)
oItems:SetProperty("SortableItem",hT,.F.)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
655
|
Is it possible to specify the cell's value but still want to display some formatted text instead the value

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Value")
oGrid:Columns():Add("FormatCell")
oItems := oGrid:Items()
h := oItems:AddItem(1)
oItems:SetProperty("CellValue",h,1,12)
oItems:SetProperty("FormatCell",h,1,"currency(value)")
h := oItems:AddItem("01/01/2001")
oItems:SetProperty("CellValue",h,1,"01/01/2001")
oItems:SetProperty("CellValueFormat",h,1,1/*exHTML*/)
oItems:SetProperty("FormatCell",h,1,"longdate(value) replace '2001' with '<b>2001</b>'")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
654
|
How can I simulate displaying groups

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h,h1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:HasLines := 0/*exNoLine*/
oGrid:ScrollBySingleLine := .T.
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumns:Add("A")
oColumns:Add("B")
oColumns:Add("C")
oItems := oGrid:Items()
h := oItems:AddItem("Group 1")
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemDividerLineAlignment",h,3/*DividerBoth*/)
oItems:SetProperty("ItemHeight",h,24)
oItems:SetProperty("SortableItem",h,.F.)
h1 := oItems:InsertItem(h,,"Child 1")
oItems:SetProperty("CellValue",h1,1,1)
oItems:SetProperty("CellValue",h1,2,2)
oItems:SetProperty("CellValue",h1,3,3)
h1 := oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("CellValue",h1,1,4)
oItems:SetProperty("CellValue",h1,2,5)
oItems:SetProperty("CellValue",h1,3,6)
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Group 2")
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemDividerLineAlignment",h,3/*DividerBoth*/)
oItems:SetProperty("ItemHeight",h,24)
oItems:SetProperty("SortableItem",h,.F.)
h1 := oItems:InsertItem(h,,"Child 1")
oItems:SetProperty("CellValue",h1,1,1)
oItems:SetProperty("CellValue",h1,2,2)
oItems:SetProperty("CellValue",h1,3,3)
h1 := oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("CellValue",h1,1,4)
oItems:SetProperty("CellValue",h1,2,5)
oItems:SetProperty("CellValue",h1,3,6)
oItems:SetProperty("ExpandItem",h,.T.)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
653
|
Is it possible to specify the cell's value but still want to display some formatted text instead the value

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("Values")
oColumn:SortType := 1/*SortNumeric*/
oColumn:AllowSizing := .F.
oColumn:Width := 64
oColumn:FormatColumn := "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("FormatCell",h,1,"'<none>'")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,10)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,15)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,25)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
652
|
I am using the FormatColumn to display the current currency, but would like hide some values. Is it possible

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("Values")
oColumn:SortType := 1/*SortNumeric*/
oColumn:AllowSizing := .F.
oColumn:Width := 64
oColumn:FormatColumn := "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
oColumn:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("FormatCell",h,1," ")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 1"),1,10)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 2"),1,15)
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Child 3"),1,25)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
651
|
How can I specify an item to be always the first item

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("first")
oItems:SetProperty("ItemPosition",h,0)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SortChildren(0,0,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
650
|
How can I specify an item to be always the last item

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("last")
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SortChildren(0,0,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
649
|
Can I allow sorting only the child items

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Childs")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:SetProperty("SortableItem",h,.F.)
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Root 2")
oItems:SetProperty("SortableItem",h,.F.)
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
648
|
Can I specify a terminal item so it will mark the end of childs

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ScrollBySingleLine := .T.
oGrid:Columns():Add("P1")
oItems := oGrid:Items()
h := oItems:AddItem("Root 1")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:InsertItem(h,"","")
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemDividerLineAlignment",h,1/*DividerCenter*/)
oItems:SetProperty("ItemHeight",h,2)
oItems:SetProperty("SelectableItem",h,.F.)
oItems:SetProperty("SortableItem",h,.F.)
h := oItems:AddItem("Root 2")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:InsertItem(h,"","")
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemDividerLineAlignment",h,1/*DividerCenter*/)
oItems:SetProperty("ItemHeight",h,2)
oItems:SetProperty("SelectableItem",h,.F.)
oItems:SetProperty("SortableItem",h,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
647
|
Is it possible to specify an item being unsortable so its position won't be changed after sorting

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:TreeColumnIndex := -1
oGrid:Columns():Add("Numbers"):SortType := 1/*SortNumeric*/
oItems := oGrid:Items()
oItems:AddItem(1)
oItems:AddItem(2)
oItems:AddItem(3)
oItems:AddItem(4)
h := oItems:AddItem("top 3")
oItems:SetProperty("ItemPosition",h,3)
oItems:SetProperty("CellHAlignment",h,0,2/*RightAlignment*/)
oItems:SetProperty("SortableItem",h,.F.)
oItems:SortChildren(0,0,.F.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
646
|
Is it possible to move an item from a parent to another

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
oItems:AddItem("A")
oItems:AddItem("B")
oItems:InsertItem(oItems:AddItem("C"),"","D")
oItems:SetParent(oItems:FindItem("D",0),oItems:FindItem("A",0))
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
645
|
How can I change the identation for an item

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
oItems:AddItem("A")
oItems:AddItem("B")
oItems:InsertItem(oItems:AddItem("C"),"","D")
oItems:SetParent(oItems:FindItem("D",0),0)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
644
|
How can I arrange the control's header on multiple levels

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DefaultItemHeight := 48
oColumns := oGrid:Columns()
oColumns:Add("Title"):Visible := .F.
oColumns:Add("FirstName"):Visible := .F.
oColumns:Add("LastName"):Visible := .F.
oColumns:Add("Photo"):Visible := .F.
oColumn := oColumns:Add("Address")
oColumn:Visible := .F.
oColumn:SetProperty("Def",16/*exCellSingleLine*/,.F.)
oColumn1 := oColumns:Add("Personal Info")
oColumn1:FormatLevel := "3:48,(0/1/2),4:96"
oColumn1:SetProperty("Def",32/*exCellFormatLevel*/,"3:48,(0/1/2),4:96")
oItems := oGrid:Items()
h := oItems:AddItem("Sales Representative")
oItems:SetProperty("CellValue",h,1,"Nancy")
oItems:SetProperty("CellValue",h,2,"Davolio")
oItems:SetProperty("CellPicture",h,3,oGrid:ExecuteTemplate("loadpicture(`c:\exontrol\images\zipdisk.gif`)"))
oItems:SetProperty("CellValue",h,4,"507-20th Ave. E.Apt. 2A")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
643
|
How can I filter programatically using more columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oColumns := oGrid:Columns()
oColumns:Add("Car")
oColumns:Add("Equipment")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem("Mazda"),1,"Air Bag")
oItems:SetProperty("CellValue",oItems:AddItem("Toyota"),1,"Air Bag,Air condition")
oItems:SetProperty("CellValue",oItems:AddItem("Ford"),1,"Air condition")
oItems:SetProperty("CellValue",oItems:AddItem("Nissan"),1,"Air Bag,ABS,ESP")
oItems:SetProperty("CellValue",oItems:AddItem("Mazda"),1,"Air Bag, ABS,ESP")
oItems:SetProperty("CellValue",oItems:AddItem("Mazda"),1,"ABS,ESP")
oColumn := oGrid:Columns:Item("Car")
oColumn:FilterType := 240/*exFilter*/
oColumn:Filter := "Mazda"
oColumn1 := oGrid:Columns:Item("Equipment")
oColumn1:FilterType := 3/*exPattern*/
oColumn1:Filter := "*ABS*|*ESP*"
oGrid:ApplyFilter()
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
642
|
How can I show the ticks for a single slider field

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("Slider"):Editor():EditType := 20/*SliderType*/
oItems := oGrid:Items()
oItems:AddItem(10)
oEditor := oItems:CellEditor(oItems:AddItem(20),0)
oEditor:EditType := 20/*SliderType*/
oEditor:SetProperty("Option",53/*exSliderTickFrequency*/,10)
oItems:AddItem(30)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
641
|
Is it possible to show ticks for slider fields

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oEditor
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oEditor := oGrid:Columns():Add("Slider"):Editor()
oEditor:EditType := 20/*SliderType*/
oEditor:SetProperty("Option",53/*exSliderTickFrequency*/,10)
oGrid:Items():AddItem(10)
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
640
|
Is it possible to colour a particular column, I mean the cell's foreground color

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oConditionalFormat
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oConditionalFormat := oGrid:ConditionalFormats():Add("1")
oConditionalFormat:SetProperty("ForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. ))
oConditionalFormat:ApplyTo := 1/*0x1+*/
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Column 1")
oColumns:Add("Column 2")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(0),1,1)
oItems:SetProperty("CellValue",oItems:AddItem(2),1,3)
oItems:SetProperty("CellValue",oItems:AddItem(4),1,5)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
639
|
Is it possible to colour a particular column for specified values

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oConditionalFormat
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oConditionalFormat := oGrid:ConditionalFormats():Add("int(%1) in (3,4,5)")
oConditionalFormat:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. ))
oConditionalFormat:ApplyTo := 1/*0x1+*/
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Column 1")
oColumns:Add("Column 2")
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(0),1,1)
oItems:SetProperty("CellValue",oItems:AddItem(2),1,3)
oItems:SetProperty("CellValue",oItems:AddItem(4),1,5)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
638
|
Is it possible to colour a particular column

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Column 1")
oColumns:Add("Column 2"):SetProperty("Def",4/*exCellBackColor*/,255)
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(0),1,1)
oItems:SetProperty("CellValue",oItems:AddItem(2),1,3)
oItems:SetProperty("CellValue",oItems:AddItem(4),1,5)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
637
|
How do i get all the children items that are under a certain parent Item handle
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems,oItems1
LOCAL h,hChild
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("P")
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:InsertItem(h,,"Child 1")
oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("ExpandItem",h,.T.)
oItems1 := oGrid:Items()
hChild := oItems1:ItemChild(oItems1:FirstVisibleItem())
DevOut( Transform(oItems1:CellValue(hChild,0),"") )
DevOut( Transform(oItems1:CellValue(oItems1:NextSiblingItem(hChild),0),"") )
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
636
|
Is is possible to use HTML tags to display in the filter caption

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarCaption := "This is a bit of text being displayed in the filter bar."
oGrid:Columns():Add("")
oItems := oGrid:Items()
oItems:AddItem("Item 1")
oItems:AddItem("Item 2")
oItems:AddItem("Item 3")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
635
|
How can I find the number of items after filtering
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:Columns():Add("")
oItems := oGrid:Items()
h := oItems:AddItem("")
oItems:SetProperty("CellValue",h,0,oItems:VisibleItemCount())
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
634
|
How can I change the filter caption

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 12801/*exFilterPromptWords+exFilterPromptContainsAll*/
oGrid:FilterBarPromptPattern := "london robert"
oGrid:FilterBarCaption := "<r>Found: ... "
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
633
|
While using the filter prompt is it is possible to use wild characters

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 16/*exFilterPromptPattern*/
oGrid:FilterBarPromptPattern := "lon* seat*"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
632
|
How can I list all items that contains any of specified words, not necessary at the beggining

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 4610/*exFilterPromptStartWords+exFilterPromptContainsAny*/
oGrid:FilterBarPromptPattern := "london davolio"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
631
|
How can I list all items that contains any of specified words, not strings

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 12802/*exFilterPromptWords+exFilterPromptContainsAny*/
oGrid:FilterBarPromptPattern := "london nancy"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
630
|
How can I list all items that contains all specified words, not strings

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 12801/*exFilterPromptWords+exFilterPromptContainsAll*/
oGrid:FilterBarPromptPattern := "london robert"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
629
|
I've noticed that the filtering by prompt is not case sensitive, is is possible to make it case sensitive

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 258/*exFilterPromptCaseSensitive+exFilterPromptContainsAny*/
oGrid:FilterBarPromptPattern := "Anne"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
628
|
Is it possible to list only items that ends with any of specified strings

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 4/*exFilterPromptEndWith*/
oGrid:FilterBarPromptColumns := "0"
oGrid:FilterBarPromptPattern := "Fuller"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
627
|
Is it possible to list only items that ends with any of specified strings

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 4/*exFilterPromptEndWith*/
oGrid:FilterBarPromptColumns := "0"
oGrid:FilterBarPromptPattern := "Fuller"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
626
|
Is it possible to list only items that starts with any of specified strings

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 3/*exFilterPromptStartWith*/
oGrid:FilterBarPromptColumns := "0"
oGrid:FilterBarPromptPattern := "An M"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
625
|
Is it possible to list only items that starts with specified string

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 3/*exFilterPromptStartWith*/
oGrid:FilterBarPromptColumns := "0"
oGrid:FilterBarPromptPattern := "A"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
624
|
How can I specify that the list should include any of the seqeunces in the pattern

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 2/*exFilterPromptContainsAny*/
oGrid:FilterBarPromptPattern := "london seattle"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
623
|
How can I specify that all sequences in the filter pattern must be included in the list

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptType := 1/*exFilterPromptContainsAll*/
oGrid:FilterBarPromptPattern := "london manager"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
622
|
How do I change at runtime the filter prompt

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptPattern := "london manager"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
621
|
How do I specify to filter only a single column when using the filter prompt

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPromptColumns := "2,3"
oGrid:FilterBarPromptPattern := "london"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
620
|
How do I change the prompt or the caption being displayed in the filter bar

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oGrid:FilterBarPrompt := "changed"
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
619
|
How do I enable the filter prompt feature

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumns
LOCAL oItems
LOCAL h0
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:ColumnAutoResize := .T.
oGrid:ContinueColumnScroll := .F.
oGrid:FocusColumnIndex := 1
oGrid:MarkSearchColumn := .F.
oGrid:SearchColumnIndex := 1
oGrid:FilterBarPromptVisible := 1/*exFilterBarPromptVisible*/
oColumns := oGrid:Columns()
oColumns:Add("Name"):Width := 96
oColumns:Add("Title"):Width := 96
oColumns:Add("City")
oItems := oGrid:Items()
h0 := oItems:AddItem("Nancy Davolio")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Andrew Fuller")
oItems:SetProperty("CellValue",h0,1,"Vice President, Sales")
oItems:SetProperty("CellValue",h0,2,"Tacoma")
oItems:SetProperty("SelectItem",h0,.T.)
h0 := oItems:AddItem("Janet Leverling")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Kirkland")
h0 := oItems:AddItem("Margaret Peacock")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"Redmond")
h0 := oItems:AddItem("Steven Buchanan")
oItems:SetProperty("CellValue",h0,1,"Sales Manager")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Michael Suyama")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Robert King")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
h0 := oItems:AddItem("Laura Callahan")
oItems:SetProperty("CellValue",h0,1,"Inside Sales Coordinator")
oItems:SetProperty("CellValue",h0,2,"Seattle")
h0 := oItems:AddItem("Anne Dodsworth")
oItems:SetProperty("CellValue",h0,1,"Sales Representative")
oItems:SetProperty("CellValue",h0,2,"London")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
618
|
How can I control the colors that can be applied to an EBN part

PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
LOCAL oItems
oItems := oGrid:Items()
oItems:SetProperty("ItemBackColor",oItems:FirstVisibleItem(),NewValue)
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oAppearance
LOCAL oColumn,oColumn1
LOCAL oColumns
LOCAL oEditor
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oAppearance := oGrid:VisualAppearance()
oAppearance:Add(2,"c:\exontrol\images\normal.ebn")
oAppearance:Add(1,"CP:2 10 3 -10 -5")
oGrid:SetProperty("SelBackColor",oGrid:BackColor())
oGrid:SetProperty("SelForeColor",oGrid:ForeColor())
oGrid:ScrollBySingleLine := .T.
oGrid:TreeColumnIndex := -1
oColumns := oGrid:Columns()
oColumn := oColumns:Add("Test")
oColumn:Width := 32
oColumn1 := oColumns:Add("RGB")
oEditor := oColumn1:Editor()
oEditor:EditType := 20/*SliderType*/
oEditor:SetProperty("Option",44/*exSliderMax*/,255)
oEditor:SetProperty("Option",41/*exSliderWidth*/,-60)
oItems := oGrid:Items()
h := oItems:AddItem("")
oItems:SetProperty("CellHAlignment",h,0,1/*CenterAlignment*/)
oItems:SetProperty("ItemDivider",h,0)
oItems:SetProperty("ItemBackColor",h,0x1000000)
oItems:SetProperty("ItemHeight",h,36)
oItems:SetProperty("SelectableItem",h,.F.)
h := oItems:InsertItem(0,1,"Red")
oItems:SetProperty("CellValue",h,1,255)
h := oItems:InsertItem(0,255,"Green")
oItems:SetProperty("CellValue",h,1,255)
h := oItems:InsertItem(0,65536,"Blue")
oItems:SetProperty("CellValue",h,1,255)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
617
|
I know this is fairly basic, but could you send me a sample that places a tree in the first column

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("heading")
oItems := oGrid:Items()
h := oItems:AddItem("Parent 1")
oItems:InsertItem(h,,"Child A")
oItems:InsertItem(oItems:InsertItem(h,,"Child B"),,"GrandChild C")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("Parent 2")
oItems:InsertItem(h,,"Child D")
oItems:InsertItem(h,,"Child E")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
616
|
How can I get the caption of focused item
PROCEDURE OnSelectionChanged(oGrid)
LOCAL oItems
oItems := oGrid:Items()
DevOut( "Handle" )
DevOut( Transform(oItems:FocusItem(),"") )
DevOut( "Caption" )
DevOut( oItems:CellCaption(oItems:FocusItem(),0) )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:SelectionChanged := {|| OnSelectionChanged(oGrid)} /*Fired after a new item has been selected.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:InsertItem(h,,"Cell 1.1")
oItems:InsertItem(h,,"Cell 1.2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("R2")
oItems:InsertItem(h,,"Cell 2.1")
oItems:InsertItem(h,,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
615
|
How can I get the caption of selected item
PROCEDURE OnSelectionChanged(oGrid)
LOCAL oItems
oItems := oGrid:Items()
DevOut( "Handle" )
DevOut( Transform(oItems:SelectedItem(0),"") )
DevOut( "Caption" )
DevOut( oItems:CellCaption(oItems:SelectedItem(0),0) )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:SelectionChanged := {|| OnSelectionChanged(oGrid)} /*Fired after a new item has been selected.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:InsertItem(h,,"Cell 1.1")
oItems:InsertItem(h,,"Cell 1.2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("R2")
oItems:InsertItem(h,,"Cell 2.1")
oItems:InsertItem(h,,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
614
|
Is it possible to let users selects cells as in Excel

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2
LOCAL oColumns
LOCAL oItems
LOCAL h,h1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:FullRowSelect := 1/*exRectSel*/
oGrid:SingleSel := .F.
oGrid:ReadOnly := -1/*exReadOnly*/
oGrid:MarkSearchColumn := .F.
oGrid:ShowFocusRect := .F.
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:SetProperty("SelForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 0,0,0 } ) , .F. ))
oGrid:SetProperty("SelBackColor",AutomationTranslateColor( GraMakeRGBColor ( { 200,225,242 } ) , .F. ))
oColumns := oGrid:Columns()
oColumns:Add("A")
oColumn := oColumns:Add("B")
oColumn:AllowSizing := .F.
oColumn:Width := 24
oColumn1 := oColumns:Add("C")
oColumn1:AllowSizing := .F.
oColumn1:Width := 24
oColumn1:SetProperty("Def",0/*exCellHasCheckBox*/,1)
oColumn1:PartialCheck := .T.
oColumn2 := oColumns:Add("D")
oColumn2:AllowSizing := .F.
oColumn2:Width := 24
oColumn2:SetProperty("Def",1/*exCellHasRadioButton*/,1)
oItems := oGrid:Items()
h := oItems:InsertItem(,,"Group 1")
h1 := oItems:InsertItem(h,,16)
oItems:SetProperty("CellValue",h1,1,17)
h1 := oItems:InsertItem(h,,2)
oItems:SetProperty("CellValue",h1,1,11)
h1 := oItems:InsertItem(h,,2)
oItems:SetProperty("ItemBackColor",h1,AutomationTranslateColor( GraMakeRGBColor ( { 240,240,240 } ) , .F. ))
oItems:SetProperty("CellValue",h1,1,9)
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:InsertItem(,,"Group 2")
oItems:SetProperty("CellValueFormat",h,2,1/*exHTML*/)
h1 := oItems:InsertItem(h,,16)
oItems:SetProperty("CellValue",h1,1,9)
h1 := oItems:InsertItem(h,,12)
oItems:SetProperty("CellValue",h1,1,11)
h1 := oItems:InsertItem(h,,2)
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("ExpandItem",h,.T.)
oItems:SetProperty("SelectItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
613
|
Is it possible to change the style for the vertical or horizontal grid lines, in the list area

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:GridLineStyle := 33/*exGridLinesVSolid+exGridLinesHDot4*/
oGrid:Columns():Add("C1")
oGrid:Columns():Add("C2")
oGrid:Columns():Add("C3")
oItems := oGrid:Items()
h := oItems:AddItem("Item 1")
oItems:SetProperty("CellValue",h,1,"SubItem 1.2")
oItems:SetProperty("CellValue",h,2,"SubItem 1.3")
h := oItems:AddItem("Item 2")
oItems:SetProperty("CellValue",h,1,"SubItem 2.2")
oItems:SetProperty("CellValue",h,2,"SubItem 2.3")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
612
|
Is it possible to change the style for the grid lines, for instance to be solid not dotted

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:GridLineStyle := 48/*exGridLinesSolid*/
oGrid:Columns():Add("Column")
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
611
|
I have some buttons added on the control's scroll bar, how can I can know when the button is being clicked

PROCEDURE OnScrollButtonClick(oGrid,ScrollBar,ScrollPart)
DevOut( Transform(ScrollBar,"") )
DevOut( Transform(ScrollPart,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:ScrollButtonClick := {|ScrollBar,ScrollPart| OnScrollButtonClick(oGrid,ScrollBar,ScrollPart)} /*Occurs when the user clicks a button in the scrollbar.*/
oGrid:SetProperty("ScrollPartVisible",1/*exHScroll*/,32768/*exLeftB1Part*/,.T.)
oGrid:SetProperty("ScrollPartVisible",1/*exHScroll*/,16384/*exLeftB2Part*/,.T.)
oGrid:SetProperty("ScrollPartVisible",1/*exHScroll*/,1/*exRightB6Part*/,.T.)
oGrid:SetProperty("ScrollPartVisible",1/*exHScroll*/,2/*exRightB5Part*/,.T.)
oGrid:ScrollBars := 5/*exDisableNoHorizontal*/
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
610
|
How do I get notified once the user clicks a hyperlink created using the anchor HTML tag

PROCEDURE OnAnchorClick(oGrid,AnchorID,Options)
DevOut( Transform(AnchorID,"") )
DevOut( Transform(Options,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:AnchorClick := {|AnchorID,Options| OnAnchorClick(oGrid,AnchorID,Options)} /*Occurs when an anchor element is clicked.*/
oGrid:Columns():Add("Default"):SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
oItems:AddItem("This is a link: <aex.com;1>www.exontrol.com</a>")
oItems:AddItem("This is a link: <aex.net;2>www.exontrol.net</a>")
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
609
|
Is it possible to start editing a cell when double click it

PROCEDURE OnDblClick(oGrid,Shift,X,Y)
oGrid:Edit()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems,oItems1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:DblClick := {|Shift,X,Y| OnDblClick(oGrid,Shift,X,Y)} /*Occurs when the user dblclk the left mouse button over an object.*/
oGrid:BeginUpdate()
oGrid:AutoEdit := .F.
oGrid:MarkSearchColumn := .F.
oGrid:Columns():Add("Edit1"):Editor():EditType := 1/*EditType*/
oGrid:Columns():Add("Edit2"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(1),1,2)
oItems1 := oGrid:Items()
oItems1:SetProperty("CellValue",oItems1:AddItem(3),1,4)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
608
|
Is it possible to disable standard single-click behavior for this column, so I manually could call Edit() when needed

PROCEDURE OnDblClick(oGrid,Shift,X,Y)
oGrid:Edit()
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems,oItems1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:DblClick := {|Shift,X,Y| OnDblClick(oGrid,Shift,X,Y)} /*Occurs when the user dblclk the left mouse button over an object.*/
oGrid:BeginUpdate()
oGrid:AutoEdit := .F.
oGrid:MarkSearchColumn := .F.
oGrid:Columns():Add("Edit1"):Editor():EditType := 1/*EditType*/
oGrid:Columns():Add("Edit2"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(1),1,2)
oItems1 := oGrid:Items()
oItems1:SetProperty("CellValue",oItems1:AddItem(3),1,4)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
607
|
How can I get or restore the old or previously value for the cell being changed
PROCEDURE OnChange(oGrid,Item,ColIndex,NewValue)
DevOut( "Old-Value:" )
DevOut( Transform(oGrid:Items:CellValue(Item,ColIndex),"") )
DevOut( "New-Value:" )
DevOut( Transform(NewValue,"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems,oItems1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:Change := {|Item,ColIndex,NewValue| OnChange(oGrid,Item,ColIndex,NewValue)} /*Occurs when the user changes the cell's content.*/
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oGrid:Columns():Add("Edit1"):Editor():EditType := 1/*EditType*/
oGrid:Columns():Add("Edit2"):Editor():EditType := 1/*EditType*/
oItems := oGrid:Items()
oItems:SetProperty("CellValue",oItems:AddItem(1),1,2)
oItems1 := oGrid:Items()
oItems1:SetProperty("CellValue",oItems1:AddItem(3),1,4)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
606
|
How can I get the item from the cursor
PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
LOCAL h
h := oGrid:ItemFromPoint(-1,-1,c,hit)
DevOut( "Handle" )
DevOut( Transform(h,"") )
DevOut( "Index" )
DevOut( Transform(oGrid:Items:ItemToIndex(h),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:DrawGridLines := 1/*exHLines*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:InsertItem(h,,"Cell 1.1")
oItems:InsertItem(h,,"Cell 1.2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("R2")
oItems:InsertItem(h,,"Cell 2.1")
oItems:InsertItem(h,,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
605
|
How can I get the column from the cursor, not only in the header

PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
DevOut( Transform(oGrid:ColumnFromPoint(-1,0),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("P1")
oGrid:Columns():Add("P2")
oGrid:DrawGridLines := -1/*exAllLines*/
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:SetProperty("CellValue",h,1,"R2")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Cell 1.1"),1,"Cell 1.2")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Cell 2.1"),1,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
604
|
How can I get the column from the cursor

PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
DevOut( Transform(oGrid:ColumnFromPoint(-1,-1),"") )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:DrawGridLines := -1/*exAllLines*/
oGrid:Columns():Add("P1")
oGrid:Columns():Add("P2")
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:SetProperty("CellValue",h,1,"R2")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Cell 1.1"),1,"Cell 1.2")
oItems:SetProperty("CellValue",oItems:InsertItem(h,,"Cell 2.1"),1,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
603
|
How can I get the cell's caption from the cursor
PROCEDURE OnMouseMove(oGrid,Button,Shift,X,Y)
LOCAL h
h := oGrid:ItemFromPoint(-1,-1,c,hit)
DevOut( oGrid:Items:CellCaption(h,c) )
RETURN
#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oItems
LOCAL h
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGrid,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/
oGrid:BeginUpdate()
oGrid:LinesAtRoot := -1/*exLinesAtRoot*/
oGrid:Columns():Add("Items")
oItems := oGrid:Items()
h := oItems:AddItem("R1")
oItems:InsertItem(h,,"Cell 1.1")
oItems:InsertItem(h,,"Cell 1.2")
oItems:SetProperty("ExpandItem",h,.T.)
h := oItems:AddItem("R2")
oItems:InsertItem(h,,"Cell 2.1")
oItems:InsertItem(h,,"Cell 2.2")
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
602
|
How can I customize the items based on the values in the cells

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3
LOCAL oColumns
LOCAL oConditionalFormat,oConditionalFormat1,oConditionalFormat2
LOCAL oConditionalFormats
LOCAL oItems
LOCAL h,h1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oConditionalFormats := oGrid:ConditionalFormats()
oConditionalFormat := oConditionalFormats:Add("%1 >4")
oConditionalFormat:Bold := .T.
oConditionalFormat:StrikeOut := .T.
oConditionalFormat:SetProperty("ForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. ))
oConditionalFormat:ApplyTo := -1/*exFormatToItems*/
oConditionalFormat1 := oConditionalFormats:Add("%2 > 4")
oConditionalFormat1:Bold := .T.
oConditionalFormat1:StrikeOut := .T.
oConditionalFormat1:SetProperty("ForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. ))
oConditionalFormat1:ApplyTo := 2/*0x2+*/
oConditionalFormat2 := oConditionalFormats:Add("%3 > 4")
oConditionalFormat2:Bold := .T.
oConditionalFormat2:StrikeOut := .T.
oConditionalFormat2:SetProperty("ForeColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. ))
oConditionalFormat2:ApplyTo := 3/*0x3+*/
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("A")
oColumn:SortType := 1/*SortNumeric*/
oColumn:AllowSizing := .F.
oColumn:Width := 36
oColumn:FormatColumn := "len(value) ? value + ' +'"
oColumn:Editor():EditType := 4/*SpinType*/
oColumn1 := oColumns:Add("B")
oColumn1:SortType := 1/*SortNumeric*/
oColumn1:AllowSizing := .F.
oColumn1:Width := 36
oColumn1:FormatColumn := "len(value) ? value + ' +'"
oColumn1:Editor():EditType := 4/*SpinType*/
oColumn2 := oColumns:Add("C")
oColumn2:SortType := 1/*SortNumeric*/
oColumn2:AllowSizing := .F.
oColumn2:Width := 36
oColumn2:FormatColumn := "len(value) ? value + ' ='"
oColumn2:Editor():EditType := 4/*SpinType*/
oColumn3 := oColumns:Add("A+B+C")
oColumn3:SortType := 1/*SortNumeric*/
oColumn3:AllowSizing := .F.
oColumn3:Width := 64
oColumn3:ComputedField := "%1+%2+%3"
oColumn3:FormatColumn := "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
oColumn3:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("CellValueFormat",h,4,2/*exComputedField*/)
h1 := oItems:InsertItem(h,,"Child 1")
oItems:SetProperty("CellValue",h1,1,7)
oItems:SetProperty("CellValue",h1,2,3)
oItems:SetProperty("CellValue",h1,3,1)
h1 := oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,5)
oItems:SetProperty("CellValue",h1,3,12)
h1 := oItems:InsertItem(h,,"Child 3")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,2)
oItems:SetProperty("CellValue",h1,3,4)
h1 := oItems:InsertItem(h,,"Child 4")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,9)
oItems:SetProperty("CellValue",h1,3,4)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|
601
|
Is it is possible to have a column computing values from other columns

#include "AppEvent.ch"
#include "ActiveX.ch"
PROCEDURE Main
LOCAL oForm
LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
LOCAL oGrid
LOCAL oColumn,oColumn1,oColumn2,oColumn3
LOCAL oColumns
LOCAL oItems
LOCAL h,h1
oForm := XbpDialog():new( AppDesktop() )
oForm:drawingArea:clipChildren := .T.
oForm:create( ,,{100,100}, {640,480},, .F. )
oForm:close := {|| PostAppEvent( xbeP_Quit )}
oGrid := XbpActiveXControl():new( oForm:drawingArea )
oGrid:CLSID := "Exontrol.Grid.1" /*{101EE60F-7B07-48B0-A13A-F32BAE7DA165}*/
oGrid:create(,, {10,60},{610,370} )
oGrid:BeginUpdate()
oGrid:MarkSearchColumn := .F.
oColumns := oGrid:Columns()
oColumns:Add("Name")
oColumn := oColumns:Add("A")
oColumn:SortType := 1/*SortNumeric*/
oColumn:AllowSizing := .F.
oColumn:Width := 36
oColumn:FormatColumn := "len(value) ? value + ' +'"
oColumn:Editor():EditType := 4/*SpinType*/
oColumn1 := oColumns:Add("B")
oColumn1:SortType := 1/*SortNumeric*/
oColumn1:AllowSizing := .F.
oColumn1:Width := 36
oColumn1:FormatColumn := "len(value) ? value + ' +'"
oColumn1:Editor():EditType := 4/*SpinType*/
oColumn2 := oColumns:Add("C")
oColumn2:SortType := 1/*SortNumeric*/
oColumn2:AllowSizing := .F.
oColumn2:Width := 36
oColumn2:FormatColumn := "len(value) ? value + ' ='"
oColumn2:Editor():EditType := 4/*SpinType*/
oColumn3 := oColumns:Add("A+B+C")
oColumn3:SortType := 1/*SortNumeric*/
oColumn3:AllowSizing := .F.
oColumn3:Width := 64
oColumn3:ComputedField := "%1+%2+%3"
oColumn3:FormatColumn := "((0:=dbl(value)) < 10? '<fgcolor=808080><font ;7>' :'<b>') + currency(=:0)"
oColumn3:SetProperty("Def",17/*exCellValueFormat*/,1)
oItems := oGrid:Items()
h := oItems:AddItem("Root")
oItems:SetProperty("CellValueFormat",h,4,2/*exComputedField*/)
h1 := oItems:InsertItem(h,,"Child 1")
oItems:SetProperty("CellValue",h1,1,7)
oItems:SetProperty("CellValue",h1,2,3)
oItems:SetProperty("CellValue",h1,3,1)
h1 := oItems:InsertItem(h,,"Child 2")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,5)
oItems:SetProperty("CellValue",h1,3,12)
h1 := oItems:InsertItem(h,,"Child 3")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,2)
oItems:SetProperty("CellValue",h1,3,4)
h1 := oItems:InsertItem(h,,"Child 4")
oItems:SetProperty("CellValue",h1,1,2)
oItems:SetProperty("CellValue",h1,2,9)
oItems:SetProperty("CellValue",h1,3,4)
oItems:SetProperty("ExpandItem",h,.T.)
oGrid:EndUpdate()
oForm:Show()
DO WHILE nEvent != xbeP_Quit
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
RETURN
|